# Contributor: psykose <alice@ayaya.dev>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=rtmidi
pkgver=5.0.0
pkgrel=0
pkgdesc="C++ classes that provide a common API for realtime MIDI input/output"
url="https://github.com/thestk/rtmidi"
arch="all"
license="MIT"
makedepends="
	alsa-lib-dev
	cmake
	jack-dev
	samurai
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/thestk/rtmidi/archive/refs/tags/$pkgver.tar.gz
	fix-pthread.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	mkdir -p "$pkgdir"/usr/lib/cmake
	mv "$pkgdir"/usr/share/rtmidi "$pkgdir"/usr/lib/cmake
	rmdir "$pkgdir"/usr/share
}

sha512sums="
f154905af9a8a85bf543f88035e8744970afe703ea3b4b2f21d85e246cf841fc86b47fd402a81bef27d4233c0d8ccf51943dc2fa42dfdd5447e1f5c3d6634297  rtmidi-5.0.0.tar.gz
eb04cfc4ff98b793c14e815314da140bba71c10475e99ed93902fc48dc85f22e1102a2b5a2b219b8c1da9e51d08a1541c37970712ac589bff4af55dbfde82713  fix-pthread.patch
"
